import request from '@/config/axios'

// CMS菜单 VO
export interface MenuVO {
  id: number // 菜单ID
  name: string // 菜单名称
  parentId: number // 父菜单ID
  modelId: number // 模型ID
  sort: number // 显示顺序
}

// CMS菜单 API
export const MenuApi = {
  // 查询CMS菜单分页
  getMenuPage: async (params: any) => {
    return await request.get({ url: `/cms/menu/page`, params })
  },

  // 查询CMS菜单详情
  getMenu: async (id: number) => {
    return await request.get({ url: `/cms/menu/get?id=` + id })
  },

  // 新增CMS菜单
  createMenu: async (data: MenuVO) => {
    return await request.post({ url: `/cms/menu/create`, data })
  },

  // 修改CMS菜单
  updateMenu: async (data: MenuVO) => {
    return await request.put({ url: `/cms/menu/update`, data })
  },

  // 删除CMS菜单
  deleteMenu: async (id: number) => {
    return await request.delete({ url: `/cms/menu/delete?id=` + id })
  },

  // 导出CMS菜单 Excel
  exportMenu: async (params) => {
    return await request.download({ url: `/cms/menu/export-excel`, params })
  },
}